//package com.china.produce.controller;
//
//
//import cn.hutool.core.date.DateUtil;
//import com.china.produce.model.PhoneModel;
//import com.china.produce.repository.PhoneRepository;
//import com.google.common.collect.Lists;
//import org.elasticsearch.index.query.MatchQueryBuilder;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.List;
//
///**
// * @ClassName
// * @Author niujie
// * @Version
// * @Description
// * @CreateTime 2023/1/12
// */
//@RequestMapping("/esPhone")
//@RestController
//public class ESPhoneController {
//
////    @Autowired
////    private ElasticsearchRestTemplate elasticsearchTemplate;
//
//    @Resource
//    private PhoneRepository phoneRepository;
//
//    @PostMapping("/testFill")
//    public void testFill() {
//        PhoneModel phoneModel = new PhoneModel();
//        phoneModel.setColors("bai");
//        phoneModel.setPrice("100");
//        phoneModel.setName("年货节");
//        phoneModel.setCreateTime(DateUtil.date());
//
//        phoneRepository.save(phoneModel);
//    }
//
//    @PostMapping("/count")
//    public long count() {
//
//        return phoneRepository.count();
//    }
//
//    @PostMapping("/getByName/{name}")
//    public List<PhoneModel> getByName(@PathVariable("name") String name) {
//        List<PhoneModel> list = new ArrayList<>();
//        MatchQueryBuilder matchQueryBuilder = new MatchQueryBuilder("name", name);
//        Iterable<PhoneModel> iterable = phoneRepository.findAll();
//        iterable.forEach(e->list.add(e));
//
//        return list;
//    }
//}
